import axios from '@/plugins/axios';
const BASE_API = import.meta.env.VITE_APP_BASE_APIURL as string;

import { CommonStore } from '@/store';
import { CommontTypes, ResponseVo, PackageTypes, PackageGroupStatusEnum } from '@/type';

export namespace PackageService {
  export const pagePackage = async (data:{title?:string,packageId?:string} & CommontTypes.IPaginationParam): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.get('/package/page',{params:data, baseURL: BASE_API});
    return res;
  };

  export const detailPackage = async (data:{packageId?:string}): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.get('/package/detail',{params:data, baseURL: BASE_API});
    return res;
  };


  export const addPackage = async (data:PackageTypes.IPackageItem): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.post('/package/add',data,{baseURL: BASE_API});
    return res;
  };

  
  export const editPackage = async (data:PackageTypes.IPackageItem): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.post('/package/edit',data,{baseURL: BASE_API});
    return res;
  };

  export const updatePackageStatus = async (id:number,status:PackageGroupStatusEnum): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.get('/package/updateStatus',{params:{id,status}, baseURL: BASE_API});
    return res;
  };
  
}
